import Vue from 'vue'
import Router from 'vue-router'


// const tarbar_item = () => import("./components/tarbar/tarbar_item")
const home = () => import("../view/home/home")
const classification = () => import("../view/classification/classification")
const cat = () => import("../view/cat/cat")
const profile = () => import("../view/profile/profile")
const detail = () => import("@/view/detail/detail")




Vue.use(Router)

export const router = new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [

    {
      path: '',
      redirect: '/home'
    },

    {
      path: '/home',
      component: home,
      meta: {
        title: "首页"

      }

    }, {
      path: '/classification',
      component: classification,
      meta: {
        title: "分类"

      }

    }, {
      path: '/cat',
      component: cat,
      meta: {
        title: "购物车"

      }

    }, {
      path: '/profile',
      component: profile,
      meta: {
        title: "我的"

      }

    }, {
      path: '/detail',
      component: detail,
      meta: {
        title: "详情页"

      }

    },


  ]
})
router.beforeResolve((to, from, next) => {
  next(),
    document.title = to.meta.title
})
